<template>
  <el-form-item label="显示格式">
    <el-select v-model="optionModel.numDisplayFormat" @change="handleNumDisplayFormatChange">
      <el-option label="数字" value="number"></el-option>
      <el-option label="百分比" value="percent"></el-option>
      <el-option label="千分位" value="subcontractor"></el-option>
    </el-select>
  </el-form-item>
  <el-form-item label="百分比显示精度" v-if="optionModel.numDisplayFormat == 'percent'">
    <el-input-number v-model="optionModel.percentPrecision" :min="0" class="hide-spin-button" style="width: 100%"></el-input-number>
  </el-form-item>
</template>

<script>
  import i18n from "@/utils/i18n"

  export default {
    name: "numDisplayFormat-editor",
    mixins: [i18n],
    props: {
      designer: Object,
      selectedWidget: Object,
      optionModel: Object,
    },
    methods: {
      handleNumDisplayFormatChange(val) {
        if (val != "percent") {
          this.optionModel.percentPrecision = 0;
        }
      },
    },
  }
</script>

<style scoped>

</style>
